package com.hd.trans.network.bean;


import com.hd.trans.common.Constants;

/**
 * Author: yang
 * Date: 2018/11/15 14:20
 * Desc: 服务器返回数据(通用形式)
 */
public class DataResponse {

    /**
     * @see Constants.ResponseCode
     * ResponseCode	     integer	    200 正常
     * ResponseMsg	     string		    返回的信息
     * ResponseData	     object	        返回的数据
     */
    protected int code;
    protected String message;
    protected String requestUrl;

//    private T data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

//    public T getData() {
//        return data;
//    }
//
//    public void setData(T data) {
//        this.data = data;
//    }


    public boolean isResponseSuccess() {
        return Constants.ResponseCode.OK == code;
    }

    /**
     * token失效
     */
    public boolean isTokenInvalid() {
        return Constants.ResponseCode.ERROR_TOKEN == code;
    }


    public String getRequestUrl() {
        return requestUrl;
    }

    public void setRequestUrl(String requestUrl) {
        this.requestUrl = requestUrl;
    }

    @Override
    public String toString() {
        return "DataResponse{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", requestUrl='" + requestUrl + '\'' +
                '}';
    }
}
